import { Component, OnInit, ViewChild } from '@angular/core';
import { NzModalRef, NzMessageService } from 'ng-zorro-antd';
import { _HttpClient } from '@delon/theme';
import { STComponent, STColumn } from '@delon/abc';
import { SFSchema } from '@delon/form';

@Component({
  selector: 'app-archive-borrow-view',
  templateUrl: './view.component.html',
})
export class ArchiveBorrowViewComponent implements OnInit {
  record: any = {};
  i: any;

  url = `/borrow`;

  searchSchema: SFSchema = {
    properties: {
      title: {
        type: 'string',
        title: '公文',
        ui: {
          placeholder: '编号/文号/文件标题',
        },
      },
      lender: {
        type: 'string',
        title: '借阅者',
        ui: {
          placeholder: '借阅者',
        },
      },
    }
  };
  @ViewChild('st') st: STComponent;
  columns: STColumn[] = [
    { title: '编号', index: 'no' },
    { title: '文号', index: 'code' },
    { title: '文件标题', index: 'title' },
    { title: '状态', index: 'status' },
    { title: '借阅者', index: 'lender' },
    { title: '借阅时间', type: 'date', index: 'lenderAt' },
    { title: '归还人', index: 'returner' },
    { title: '归还时间', type: 'date', index: 'returnAt' },
  ];

  constructor(
    private modal: NzModalRef,
    public msgSrv: NzMessageService,
    public http: _HttpClient
  ) { }
  ngOnInit(): void {
    this.i = this.record
  }

  close() {
    this.modal.destroy();
  }
}
